package com.jsj.controller;

import com.jsj.pojo.Laboratory;
import com.jsj.service.LaboratoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class LaboratoryController {

    @Autowired
    LaboratoryService laboratoryService;
//查询所有实验室
    @RequestMapping("queryAllLaboratory")
    @ResponseBody
    public List<Laboratory> queryAllLaboratory(){

        List<Laboratory> laboratoryList = laboratoryService.queryAllLaboratory();
        return laboratoryList;
    }
//关键字搜索
    @RequestMapping("queryLaboratory")
    @ResponseBody
    public List<Laboratory> queryLaboratory(String laboratory){

        List<Laboratory> laboratoryList = laboratoryService.queryLaboratory(laboratory);
        return laboratoryList;
    }
//更新实验室信息
    @RequestMapping("updateByLabId")
    @ResponseBody
    public Boolean updateByLabId(Laboratory laboratory){
        Boolean aBoolean = laboratoryService.updateByLabId(laboratory);
        return aBoolean;

    }
    //删除实验室
    @RequestMapping("delLabById")
    @ResponseBody
    public Boolean delLabById(int labId){
        Boolean aBoolean = laboratoryService.delLabById(labId);
        return aBoolean;

    }
    //增加实验室
    @RequestMapping("addLaboratory")
    @ResponseBody
    public Boolean addLaboratory(Laboratory laboratory){

        Boolean aBoolean = laboratoryService.addLaboratory(laboratory);
        return aBoolean;
    }



}
